package com.symphony.preperetion;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Aaa {
	
	private void go() {
		System.out.println("go()");
	}
	
	class B {
		private Aaa a = new Aaa();;
		public void go2() {
			go();
			a.go();
		}
		
	}
}

class Anonym {
	
}

public class AnyTryings {

	static void go(int ... i) {
		
	}
	
	public static void main(String[] args) {
		Integer i1 = 10;
		Integer i2 = 10;
		
		Integer i3 = new Integer(10);
		Integer i4 = new Integer(10);
		
		System.out.println(i1 == i2);
		System.out.println(i1.equals(i2));
		
		System.out.println(i3 == i4);
		System.out.println(i3.equals(i4));
		
		System.out.println('A' < 'a');
		Set s = new HashSet();
		s.add(new Object());
		s.add(new String());
		System.out.println(s.size());
		
		Anonym a = new Anonym(); 

		Anonym b = new Anonym() {
			
		};
		Runnable r = new Runnable() {
			
			@Override
			public void run() {
			}
		};
		System.out.println(a.getClass());
		System.out.println(b.getClass());
		System.out.println(r.getClass());
		
		System.out.println(new Thread() instanceof Runnable);
		
		System.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		
		System.out.println(new IllegalStateException() instanceof RuntimeException);
		
		System.out.println(new HashSet() instanceof List);
		
		StringBuilder builder = new StringBuilder();
		StringBuffer buffer = new StringBuffer();
//		builder = new StringBuffer(); - wrong
		builder.append(buffer);
		buffer.append(builder);
		CharSequence cs = buffer;
		
		Boolean bool1 = new M() instanceof I;
		System.out.println(bool1);
		
		Boolean bool = new C() instanceof Comparable;
		
		System.out.println(bool);
		
		Boolean bool2 = new String() instanceof CharSequence;
		
		Pattern pattern = Pattern.compile("\\d [a-z]+");
		Matcher matcher = pattern.matcher("123 a 34a ");
		while (matcher.find()) {
			System.out.println(matcher.start() + " " );
		}
		
		int tt = 11, qq = 22, as = 33;
        List list = new ArrayList();
        list.add(tt); list.add(qq); list.add(as);
        int result=0;
        for (Object eye : list)
        {
            result += (Integer)eye;
        }
        System.out.println(result);
        
        Math.random();
        
        try {
        	int y = 0;
        } finally{
//        	y++;
        }
     
        int x= 10; // #1
//        float f = 10.0; // #2
        int i = 10/3; // #3
        double d = 12.3f; // #4
        float f2 = 10; // #5
        
        int aaa = 1;
        System.out.println(aaa++);
        
        E.A.ordinal();
        
        Integer x2 = 1;
        
        byte byte1 = 1;
        int s1 = 1;
        short s2 = 1;
//        byte byte2 = byte1 + byte1;
        
        
        double d1 = 1.5;
        d1++;
        System.out.println(d1);
        
        String test = "test//test//";
        System.out.println(test);
        test = test.replaceAll("//", "/");
        System.out.println(test);
        
        int[] mas = new int[]{1, 3, 2};
        Arrays.sort(mas);
        for(int ii : mas) {
        	System.out.println(ii);
        }
        
	}
	
	enum E {
		A;
	}
	
	int m() [] {
		return new int[1];
	}
}

interface I{}
//final 
class C extends Thread implements Runnable {
	
	public static void sleep(long m) {
	}
	
	public int hashCode() {return 2;}
	
}
final 
class M implements I {

	@Override
	public int hashCode() {
		return 0;
	}

	@Override
	public boolean equals(Object o) {
		return true;
	}

	int fibonachi(int n) {
		if (n == 1 || n == 2) {
			return 1;
		} else {
			return fibonachi(n - 1) + fibonachi(n - 2);
		}
	}
}
